package com.mbigger.hessionserver;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.remoting.caucho.HessianServiceExporter;

@Configuration
public class HessionServiceConfig {

    @Autowired
    private HessionService hessionService;

    @Autowired
    private AnotherService anotherService;

    @Bean("/hessionService")
    public HessianServiceExporter hessionService() {
        HessianServiceExporter exporter = new HessianServiceExporter();
        exporter.setService(hessionService);
        exporter.setServiceInterface(HessionService.class);
        return exporter;
    }

    @Bean("/anotherService")
    public HessianServiceExporter anotherService(){
        HessianServiceExporter exporter = new HessianServiceExporter();
        exporter.setService(anotherService);
        exporter.setServiceInterface(AnotherService.class);
        return exporter;
    }
}
